import java.util.Date;

/**
 * 
 */

/**
 * @author Enzo
 *
 */
public class ToDoItem implements Comparable<ToDoItem>{

	
	//Class Variables
	private Date date;
	private String toDoString;
	private int priority;
	
	public ToDoItem(Date date, String toDoString, int priority) {
		super();
		this.date = date;
		this.toDoString = toDoString;
		this.priority = priority;
	}
	
	
	//-------------------------
	//Getters and Setters
	//-------------------------
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public String getToDoString() {
		return toDoString;
	}
	public void setToDoString(String toDoString) {
		this.toDoString = toDoString;
	}
	public int getPriority() {
		return priority;
	}
	public void setPriority(int priority) {
		this.priority = priority;
	}


	@Override
	public int compareTo(ToDoItem o) {
	    final int BEFORE = -1;
	    final int EQUAL = 0;
	    final int AFTER = 1;
	    
	    //If both objects are the same object
		if(this == o){
			return EQUAL;
		}
		
		if(this.getPriority() > o.getPriority()){
			return AFTER;
		}
		if(this.getPriority() < o.getPriority()){
			return BEFORE;
		}

		return 0;
	}



}
